package trb.complexshield.bool.distance;

import no.hrp.hvrc.utils.j3d.Vec3;

/**
 * Created by admin on 20/05/14.
 */
public class SubtractDistance implements DistanceProducer {

    private final DistanceProducer a;
    private final DistanceProducer b;

    public SubtractDistance(DistanceProducer a, DistanceProducer b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public float getDistance(Vec3 pos) {
        return Math.max(-b.getDistance(pos), a.getDistance(pos));
    }
}
